from math import radians

from numpy import square
from manimlib import *

class Test(Scene):
    #75cfb8
    #bbdfc8
    #f0e5d8
    #ffc478
    def construct(self):
        o1,o2=-4,-2.5
        o=[o1,o2,0]
        a,b=[o1+6,o2,0],[o1+9,o2,0]
        c,d=[o1,o2+2,0],[o1+6,o2+2,0]
        e=[o1,o2+6,0]
        s=Polygon(o,a,d,c).set_fill('#75cfb8',1)
        s=Polygon(o,a,d,c).set_fill('#75cfb8',1)
        p=Polygon(o,b,e)
        line_x=Line(c,d)
        line_y=Line(a,d)
        b4=always_redraw(Brace,Line(c,e),LEFT)
        b4=Brace(Line(c,e),LEFT)
        t4=Tex('4').next_to(b4,LEFT)
        b3=Brace(Line(a,b),DOWN)
        t3=Tex('3').next_to(b3,DOWN)
        t1=Tex('=?').to_corner(UR,buff=1)
        ss=s.copy().scale(0.3).next_to(t1,LEFT)
        self.add(p,line_x,line_y,b4,t4,b3,t3,s,ss,t1)
        self.wait()
        x=Tex('x').next_to(line_x,UP)
        y=Tex('y').next_to(line_y,LEFT)
        self.add(x,y)
        # self.play(Transform(ss,pp))
        self.wait()
        self.remove(x,y)
        ss.become(Text('整个图形面积最小值').next_to(t1,LEFT))
        self.wait()
        self.add(x,y)
        self.wait()
